#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N=2e5+10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
int t;
void solve()
{
	cin>>t;
	unordered_map<char,int> cnt;
	vector<string> v;
	while(t--)
	{
		string s;
		cin>>s;
		v.push_back(s);
		for(int i=0;i<s.size();i++) cnt[s[i]]++;
	}
	

	for(int i=0;i<v.size();i++)
	{
		unordered_set<char> cur;
		int n=v[i].size();

		for(int j=0;j<n;j++)
		{
			char ch=v[i][j];
			cur.insert(ch);
		}

		for(auto [k,sz]:cnt)
		{
			if(sz==n&&cur.find(k)==cur.end())
			{
				cout<<v[i]<<'\n';
				break;
			}
		}
	}	
}

int main()
{
	solve();
	return 0;
}